package moonlit.chill.pay.payEnum;

import lombok.Getter;

/**
 * @author MoonlitChill
 * @date 2024/4/15 11:43
 */
@Getter
public enum PayStrategyEnum {

    WX_PC_PAY("0-1","wxV3PcPayStrategy"),

    WX_CODE_PAY("0-3","wxCodePayStrategy"),

    WX_MINI_PAY("0-4","wxV3MiniPayStrategy"),

    WX_QUERY("0-Q","wxV3QueryStrategy"),

    WX_REFUND_QUERY("0-R-Q","wxV3RefundQueryStrategy"),

    WX_REFUND("0-R","wxV3RefundStrategy"),

    WX_NOTIFY("0-N","wxV3NotifyStrategy"),

    WX_BILL("0-B","wxV3BillStrategy"),

    ALI_PC_PAY("1-1", "aliPcPayStrategy"),

    ALI_H5_PAY("1-2", "aliH5PayStrategy"),

    ALI_CODE_PAY("1-3", "aliCodePayStrategy"),

    ALI_MINI_PAY("1-4", "aliMiniPayStrategy"),

    ALI_QUERY("1-Q", "aliQueryPayStrategy"),

    ALI_REFUND_QUERY("1-R-Q", "aliRefundQueryPayStrategy"),

    ALI_REFUND("1-R", "aliRefundStrategy"),

    ALI_NOTIFY("1-N", "aliNotifyStrategy"),

    ALI_BILL("1-B", "aliNotifyStrategy"),

    CASH("4-6", "cashPayStrategy"),

    CREDIT_PAY("5-9", "creditPayStrategy"),

    CREDIT_REFUND("5-R", "creditRefundStrategy"),

    PRE_STORE_PAY("6-8", "preStorePayStrategy"),

    PRE_STORE_REFUND("6-R", "preStoreRefundStrategy");

    private final String code;

    private final String name;

    PayStrategyEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public static PayStrategyEnum getPayStrategyEnum(final String code){
        PayStrategyEnum[] payEnums = PayStrategyEnum.values();
        if (code != null){
            for (PayStrategyEnum payEnum : payEnums) {
                if (payEnum.code.equals(code)){
                    return payEnum;
                }
            }
        }
        return null;
    }
}
